{% extends 'base.html' %}
<!--generate html-->
{% block content %}
    <script src="/static/ckeditor/ckeditor.js"></script>
        <script
        type = "text/javascript">
            $(
                function () {

                ClassicEditor
    .create( document.querySelector( '#id_content' ), {
        heading: {
            options: [
                { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
                { model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
                { model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' }
            ]
        }
    } )
    .catch( error => {
        console.log( error );
    } );


                }
            );


        function postCkeditor() {
            var ck = CKEDITOR.instances['id_content'];

            $('#id_content').val(ck.getData());

            return true;
        }

    </script>
    <table class="table table-bordered " style="width:700px;">
        <form action="/cms/article_edit/{{ id }}" method="post" id="form1">

            <tr>
                <td>{{ form.name.label }}</td>
                <td>{{ form.name }}{{ form.name.errors }}</td>
            <tr>


            <tr>
                <td>{{ form.content.label }}</td>
                <td>{{ form.content }}{{ form.content.errors }}</td>
            <tr>
            <tr>

                <td colspan="2"><input type="submit" value="保存" class="btn btn-primary" id="submit"
                                       onclick="postCkeditor();"></td>
        </form>
    </table>

    {{ form.errors }}


{% endblock %} 